<!-- 时长记录 -->
<template>
	<view class="time">
		<z-paging ref="paging" v-model="dataList" @query="queryList" class="box" v-if="isshow">

			<view class="item" v-for="(item,index) in dataList" :key="index">
				<view class="top">
					<view class="left">购买时间:</view>
					<view class="right">{{item.createTime}}</view>
				</view>
				<view class="bot">
					<view class="left">{{typeTxt(item.recordType)}}</view>
					<view class="right">+{{item.saveNum}}天</view>
				</view>
			</view>

		</z-paging>
	</view>
</template>

<script>
	import {
		vipRecord
	} from '@/apis/apis.js'
	export default {
		data() {
			return {
				isshow:false,
				dataList: [{
						time: '2021-18-19 12：00',
						type: '会员购买',
						add: '+30天'
					},
					{
						time: '2021-18-19 12：00',
						type: '分销奖励',
						add: '+15天'
					},
					{
						time: '2021-18-19 12：00',
						type: '会员购买',
						add: '+90天'
					}
				]
			}
		},
		onShow() {
			this.isshow = true
		},
		onHide() {
			this.isshow = false
		},
		methods: {
			queryList(pageNum, pageSize) {
				vipRecord({
					pageNum: pageNum,
					pageSize: pageSize
				}).then(res => {
					console.log(res)
					//createTime
					//recordType  记录类型（1：会员购买，2：分享赠送，3：拼单奖励）
					//saveNum 购买天数
					this.dataList = res.data
					this.$refs.paging.complete(this.dataList);
				})
			},
			typeTxt(v) {
				let str = ''
				switch (v) {
					case 1:
						str = '会员购买'
						break;
					case 2:
						str = '分享赠送'
						break;
					case 3:
						str = '拼单奖励'
						break;
					case 4:
						str = '系统赠送'
						break;
				}
				return str
			}
		}
	}
</script>

<style lang="scss" scoped>
	.time {
		height: 100vh;
		background-color: #F8F8F8;
	}

	.box {
		padding: 38rpx 30rpx 0;

		.item {
			border-radius: 10rpx;
			background-color: #fff;
			margin-bottom: 26rpx;

			.top,
			.bot {
				display: flex;
				align-items: center;
			}

			.top {
				font-size: 26rpx;
				border-bottom: 2rpx solid #E9E9E9;
				padding: 36rpx 0 28rpx 26rpx;

				.left {
					margin-right: 26rpx;
					color: #343434;
				}

				.right {
					color: #999999;
				}

			}

			.bot {
				justify-content: space-between;
				font-size: 30rpx;
				padding: 42rpx 30rpx 44rpx 26rpx;

				.left {
					color: #1A1A1A;
				}

				.right {
					color: #194FC9;
					font-weight: bold;
					font-size: 28rpx;
				}
			}
		}
	}
</style>
